<script>
$(function() {
	$( "#tabss" ).tabs({
	    select: function(event, ui) {
	        var url = $.data(ui.tab, 'load.tabs');
	        if( url ) {
	            location.href = url;
	            return false;
	        }
	        return true;
	    },
	selected: 1
	});
});
</script>
<div id="tabss">
	<ul>
        <li><?php echo $this->Html->link(__('Danh sách quyền', true), array('controller' => 'phanquyens', 'action' => 'index',$chucdanh_id)); ?> </li>
        <li><a href='#themq'>Thêm quyền</a> <?php //echo $this->Html->link(__('Thêm quyền', true), array('controller'=>'phanquyens','action' => 'them',$chucdanh_id)); ?></li>
        <li><?php echo $this->Html->link(__('Danh sách chức danh', true), array('controller'=>'chucdanhs','action' => 'index')); ?></li>
	</ul>

<?php
//function created (uses for checking all checkbox and confirm to delete selected item) which is in /js/custom_scripts.js
    echo $javascript->link('custom_scripts');
?>

<div class="roles index" id='themq'>
<?php echo $this->Form->create('Phanquyen',array('url'=>'luu/'.$chucdanh_id));?>
	<h2><?php __('Thêm quyền sử dụng cho chức danh '.$tencd[0] ['chucvs'] ['tenchucvu']);?></h2>
	<table cellpadding="0" cellspacing="0" id="tables">
	<tr>
            <th style="width: 10px;"><input type="checkbox" onclick="checkAll(this);" /></th>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Tên quyền';?></th>
			
	</tr>
	<?php
	$i = 0;$stt=0;
	for ($j=0;$j<count($role);$j++){
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
        <?php
	           echo '<td width="3%"><input type="checkbox" value="'.$role[$j]['roles']['id'].'" 
            name="data[Phanquyen][checked][]" id="'.$i.'" ></td>';
        ?>	
		<td><?php echo $stt=$stt+1; ?>&nbsp;</td>
		<td><?php echo $role[$j]['roles']['rolename']; ?>&nbsp;</td>
	</tr>
<?php } ?>
	</table>
<div align="center" style="margin-top: 10px;"><?php echo $this->Form->end(__('Thêm quyền', true));?></div>
</div>
</div>